<?php

/**
 * URL类
 *
 * @author jonwang(jonwang@myqee.com)
 * @category   MyQEE
 * @package    System
 * @subpackage Core
 * @copyright  Copyright (c) 2008-2011 myqee.com
 * @license    http://www.myqee.com/license.html
 */
class MyQEE_Core_Url
{

    public $url = '';

    public function __construct($url = '')
    {
        $this->url = $url;
    }

    /**
     * 获取站点URL
     */
    public function site($uri = '')
    {
        if ( is_array(Core::$project_config['url']) )
        {
            $project_url = Core::$project_config['url'][0];
        }
        else
        {
            $project_url = (string)Core::$project_config['url'];
        }
        return rtrim($project_url, '/') . '/' . ltrim($uri, '/');
    }

    public function __toString()
    {
        return $this->site($this->url);
    }
}